package action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import manager.AgencyManager;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import dataType.AgencyData;
import dataType.ErrorData;


public class ActionModificarAgencia3 extends Action {

	private static final long serialVersionUID = 1L;

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest req, HttpServletResponse resp) {
		
			AgencyData agency =(AgencyData) form;
			AgencyManager am = new AgencyManager();
			try {
				am.updateAgency(agency);
				return mapping.findForward("ok");
			} catch (Exception e) {
				ErrorData error = new ErrorData(e.getMessage());
				req.setAttribute("errorData",error );
				return mapping.findForward("errorPage");	
			}
	}
}


